package com.yuan.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Queue;

/**
 * Explain:     [集合工具类]
 * Date:        [2017/10/26 16:09]
 * Coder:       [YouYuan]
 * Version:     [1.0]
 */
public class CollectionUtil {

    /**
     * 将队列转换成List
     * @param queue
     * @return
     */
    public static <T> List<T> queueToList(Queue<T> queue){
        if (queue == null) {
            return null;
        }
        List<T> list = new ArrayList<T>(queue.size());
        while (!queue.isEmpty()) {
            list.add(queue.poll());
        }
        return list;
    }

}
